package com.zwf.controller.user;

import com.zwf.entity.Category;
import com.zwf.result.Result;
import com.zwf.service.CategoryService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @Author zwf
 * @date 2024/2/6 20:15
 */

@RestController("userCategoryController")
@Slf4j
@RequestMapping("/user/category")
@Api(tags = "分类接口")
public class CategoryController {

    @Autowired
    CategoryService categoryService;

    @GetMapping("/list")
    @ApiOperation("条件查询")
    public Result<List<Category>> list(Integer type){
        log.info("条件查询：{}",type);
        List<Category> category=categoryService.queryByType(type);
        return Result.success(category);
    }
}
